<?
 require("users.php");
 
 if(isset($_POST['edit']))
 {
 	if($_POST['edit'] === '1')
	{
		$results = updateUsers($_POST);	

		header('location:list.php');
	}
 }
 
  /*
  * 
						<? if($results) :?>
						<dl>
							<? foreach ($variable as $key => $value): ?>
							
								<dt><?=$key?></dt>
								<dd><?=$value?></dd>
							<? endforeach; ?>
							
						</dl>
						<? endif; ?>	 	
  * 
  */
 //$results = array();
//<img src="../images/stiglogo.png" alt="" class="img-polaroid">

 $results = getUsersInfo($_GET['id']);

 $row = $results->fetch_assoc();
 
?>
<!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8" />
        <title><?=$title ?> Edit User: <?=$row['id'] ?></title>
         <? require('../inc/header-info.php'); ?>
    </head>
    <body>
        <div class="container">
            <? include('../inc/nav.php'); ?>
             <form name="form1" method="post" action="edit.php">
             	<h4>Edit Employee: </h4>
             	<input type="hidden" name="edit" value='1'> 
            	<input type="hidden" name="id" value='<?=$row['id'] ?>'> 					
    			
					<label class="control-label" for="first_name">First Name:</label>
					<div class="controls">
						<input type="text" id="first_name"  name="first_name" placeholder="First Name" <? if($row['first_name']){ echo "value='$row[first_name]'";} ?>>
					</div>
				
				
					<label class="control-label" for="middle_name">Middle Name:</label>
					<div class="controls">
						<input type="text" id="middle_name" name="middle_name" placeholder="Middle Name" <? if($row['middle_name']){ echo "value='$row[middle_name]'";} ?>>
					</div>
				
					<label class="control-label" for="last_name">Last Name:</label>
					<div class="controls">
						<input type="text" id="last_name" name="last_name" placeholder="Last Name" <? if($row['last_name']){ echo "value='$row[last_name]'";} ?>>
					</div>
    		
            	<div class="form-actions">
  					<button type="submit" class="btn btn-primary">Save changes</button>
					<a href="<?=$url?>employees/index.php"><button class="btn btn-primary" type="button">Cancel</button></a>
				</div>	
            </form> 
		</div>
	</body>
</html>